<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../public/header.jsp"%>
<img src="<%=request.getContextPath()+"/resources/images/main_logo.jpg"%>" class="logo">
<div id="table-wrapper" class="table-wrapper">
	<div class="form-header" style="margin-bottom: 1px sold #15418B;">
		<div class="form-title">
			<fmt:message key="label.weight.table.title"></fmt:message>
		</div>
	</div>
	<div id="grig_container" class="weight-grid-contailner">
	<c:if test="${not empty weights}">
		<c:forEach var="weight" items="${weights}">
			<a href="<%=request.getContextPath()+"/private/weight/initEditWeight.action?id="%>${weight.id}" class="weight-item">
				&nbsp;&nbsp;
				<fmt:message key="label.date"/>: 
				<span class="datetime">${weight.date}</span> &nbsp;
				<fmt:message key="label.weight.kg"/>: 
				<span class="weight">${weight.weight}</span> &nbsp;
				<fmt:message key="label.weight.diff.kg"/>
				<fmt:message key="label.day"/>:
				<c:choose>
					<c:when test="${weight.dayDifference > 0}">
						<span class="overweight">${weight.dayDifference}</span> &nbsp;
					</c:when>
					<c:otherwise>
						<span class="underweight">${weight.dayDifference}</span> &nbsp;
					</c:otherwise>
				</c:choose>
				<fmt:message key="label.week"/>:
				<c:choose>
					<c:when test="${weight.weekDifference > 0}">
						<span class="overweight">${weight.weekDifference}</span> &nbsp;
					</c:when>
					<c:otherwise>
						<span class="underweight">${weight.weekDifference}</span> &nbsp;
					</c:otherwise>
				</c:choose> 
				<fmt:message key="label.month"/>:
				<c:choose>
					<c:when test="${weight.monthDifference > 0}">
						<span class="overweight">${weight.monthDifference}</span> &nbsp;
					</c:when>
					<c:otherwise>
						<span class="underweight">${weight.monthDifference}</span> &nbsp;
					</c:otherwise>
				</c:choose>
				<c:if test="${weight.trenning == true}">
					<div class="trenning">
						<fmt:message key="label.sport.lesson"/>
					</div>
				</c:if>
				<c:if test="${not empty weight.eatings}">
					<ul>
					<c:forEach var="eating" items="${weight.eatings}">
						<c:if test="${eating.food.length() > 0}">
						<li>
							<c:choose>
							<c:when test="${eating.overweight == true}">
								<span class="overweight">${eating.eatingType.displayName}</span>
							</c:when>
							<c:otherwise>
								<span class="underweight">${eating.eatingType.displayName}</span>
							</c:otherwise>
							</c:choose>
							: <span class="datetime">${eating.time}</span> 
							<span>${eating.food}</span>
						</li>
						</c:if>
					</c:forEach>
					</ul>
				</c:if>													
			</a>
		</c:forEach>
	</c:if>
	</div>
</div>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/app/main.js"></script>
<%@include file="../public/footer.jsp"%>